package com.itheima.继承;

/*
7、【编号：1007】结合继承的思想，分析下列需求并实现
定义项目经理类Manager 【属性：姓名 工号 工资 奖金】【行为：工作work】
定义程序员类Coder【属性：姓名 工号 工资】【行为：工作work】
要求：通过有参构造创建两个类的对象，并调用各自的work方法
运行结果：
姓名为:张三,工号为:9527,工资为:10000.0,的程序员正在编写代码
姓名为:李四,工号为:9528,工资为:15000.0,奖金为:2000.0,的项目经理正在管理程序员写代码
 */
public class Test07 {
    public static void main(String[] args) {
        Manager manager = new Manager();
        manager.work();
        Coder coder = new Coder();
        coder.work();

    }
}

class Person1 {
    private String name;
    private String num;
    private double wages;

    public Person1() {
    }

    public Person1(String name, String num, double wages) {
        this.name = name;
        this.num = num;
        this.wages = wages;

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNum() {
        return num;
    }

    public void setNum(String num) {
        this.num = num;
    }

    public double getWages() {
        return wages;
    }

    public void setWages(int wages) {
        this.wages = wages;
    }


}

class Manager extends Person1 {
    private double bonus;

    public Manager() {
    }

    public Manager(String name, String num, int wages, double bonus) {
        super(name, num, wages);
        this.bonus = bonus;
    }

    public double getBonus() {
        return bonus;
    }

    public void setBonus(int bonus) {
        this.bonus = bonus;
    }

    public void work() {
        System.out.println("姓名为:" +super.getName()  + ",工号为:" + super.getNum() + ",工资为:" +super.getWages() + ",奖金为:" + bonus + ",的项目经理正在管理程序员写代码");
    }
}
class Coder extends Person1 {
    public Coder() {
    }
    public Coder(String name, String num, double wages) {
        super(name, num, wages);
    }

    public void work() {
        System.out.println("姓名为:" + super.getName() + ",工号为:" +super.getNum() + "工资为:"+super.getWages()+",的程序员正在编写代码");
    }
}